home *** CD-ROM | disk | FTP | other *** search
/ Champak 120 / Vol 120.iso / games / battlefi.swf / scripts / frame_636 / PlaceObject2_402_1341 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2010-11-09  |  2KB  |  72 lines

  1. onClipEvent(enterFrame){
  2.    if(_root.vic)
  3.    {
  4.       this._y = 491.2;
  5.    }
  6.    if(_root.loss)
  7.    {
  8.       this._y = 491.2;
  9.    }
  10.    if(!this.hitTest(_root.castle))
  11.    {
  12.       this._x += speed;
  13.    }
  14.    if(duped && _root.population < _root.poptot)
  15.    {
  16.       _root.population = _root.population + 1;
  17.       _root.gold -= 500;
  18.       i++;
  19.       duplicateMovieClip(_root.cav,"cav" + i,16384 + (300 + i));
  20.       _root["cav" + i]._x = -6.399999999999999;
  21.       _root["cav" + i]._y = random(50) + 201.7;
  22.       duped = false;
  23.    }
  24.    if(this.hitTest(_root.castle) && !attackin)
  25.    {
  26.       this.gotoAndPlay("attk");
  27.       attackin = true;
  28.    }
  29.    if(this.dead && this._currentframe < 13)
  30.    {
  31.       this.gotoAndPlay("die");
  32.    }
  33.    l = 1;
  34.    while(l < _root.lvl + 1)
  35.    {
  36.       if(this.hit.hitTest(_root["a" + l]))
  37.       {
  38.          this.gotoAndPlay("hurt");
  39.          remaining--;
  40.          attackin = false;
  41.          _root["a" + l].removeMovieClip();
  42.       }
  43.       l++;
  44.    }
  45.    f = 1;
  46.    while(f < Math.round(_root.lvl / 2 + 1))
  47.    {
  48.       if(this.hit.hitTest(_root.castle["th" + f]))
  49.       {
  50.          this.gotoAndPlay("hurt");
  51.          remaining--;
  52.          attackin = false;
  53.          _root.castle["th" + f].removeMovieClip();
  54.       }
  55.       f++;
  56.    }
  57.    if(this.dead)
  58.    {
  59.       this._x -= speed;
  60.    }
  61.    if(this.deadfull)
  62.    {
  63.       this._x = -1000000000;
  64.    }
  65.    if(remaining == 0)
  66.    {
  67.       this.gotoAndPlay("die");
  68.       remaining = 500;
  69.    }
  70.    this.hp._xscale = remaining / 3 * 100;
  71. }
  72.